/*点击按钮弹出框打开独立页面*/
function add_user() {
	$.dialog({
		title: '添加人员',
		width: 600,
		height: 280,
		lock:true,
		content: 'url:add_user.html',
		init: function() {
			//var iframe = this.iframe.contentWindow;
			//var ul = iframe.document.getElementById('right_list');
		},
		button: [{
			name: '保存',
			callback: function() {
				var iframe = this.iframe.contentWindow;
				if(!iframe.document.body) {
					alert('iframe还没加载完毕呢')
					return false;
				};
			},
			focus: true

		}, {
			name: '取消',
			callback: function() {

			}
		}]
	});
}
//添加合同
/*function addPact() {
	$.dialog({
		title: '添加合同',
		width: 600,
		height: 280,
		content: 'url:/market/addPact',
		init: function() {
			var iframe = this.iframe.contentWindow;
			var ul = iframe.document.getElementById('right_list');
		},
		button: [{
			name: '保存',
			callback: function() {
				var iframe = this.iframe.contentWindow;
				var btn = iframe.document.getElementById('btnn').click();
				if(btn==true){
				}else{
					if(iframe.document.getElementById('checkTF').value==1){
						window.location.href="/market/list";
						return false;
					}
				}
			},
			focus: true

		}, {
			name: '取消',
			callback: function() {

			}
		}]
	});
}*/
//添加客户信息
/*点击按钮弹出框打开独立页面*/
function addCustomer() {
$.dialog({
	title: '添加客户',
	width: 600,
	height: 380,
	content: 'url:/admin/customer/addCustomer',
	init: function() {
		var iframe = this.iframe.contentWindow;
		var ul = iframe.document.getElementById('right_list');
	},
	button: [{
		name: '保存',
		callback: function() {
			var iframe = this.iframe.contentWindow;
			var btn = iframe.document.getElementById('btnn').click();
			if(btn==true){
				
			}else{
				return false;
			}
		},
		focus: true

	}, {
		name: '取消',
		callback: function() {

		}
	}]
});
}
//添加收款计划
function addReceipt() {
	$.dialog({
		title: '添加收款计划',
		width: 600,
		height: 580,
		content: 'url:/market/receipt/addReceipt',
		init: function() {
			var iframe = this.iframe.contentWindow;
			var ul = iframe.document.getElementById('right_list');
		},
		button: [{
			name: '保存',
			callback: function() {
				var iframe = this.iframe.contentWindow;
				var btn= iframe.document.getElementById('btnn').click();
				if(btn==true){
					
				}else{
					return false;
				}
			},
			focus: true

		}, {
			name: '取消',
			callback: function() {

			}
		}]
	});
}
//添加后台用户
function addAdminUser() {
	$.dialog({
		title: '添加后台用户',
		width: 600,
		height: 580,
		content: 'url:/admin/user/adds',
		init: function() {
			var iframe = this.iframe.contentWindow;
			var ul = iframe.document.getElementById('right_list');
		},
		button: [{
			name: '保存',
			callback: function() {
				var iframe = this.iframe.contentWindow;
				var btn= iframe.document.getElementById('btnn').click();
				if(btn==true){
					
				}else{
					return false;
				}
			},
			focus: true

		}, {
			name: '取消',
			callback: function() {

			}
		}]
	});
}
//添加角色
function addRole(pn) {
	$.dialog({
		title: '添加角色',
		width: 600,
		height: 80,
		content: 'url:/admin/role/roleInfo?_op=add&identify='+pn,
		init: function() {
			var iframe = this.iframe.contentWindow;
			var ul = iframe.document.getElementById('right_list');
		},
		button: [{
			name: '保存',
			callback: function() {
				var iframe = this.iframe.contentWindow;
				var btn= iframe.document.getElementById('btnn').click();
				if(btn==true){
					
				}else{
					return false;
				}
			},
			focus: true

		}, {
			name: '取消',
			callback: function() {

			}
		}]
	});
}
//修改角色
function editRole(pn) {
	$.dialog({
		title: '修改角色',
		width: 600,
		height: 80,
		content: 'url:/admin/role/roleInfo?_op=update&roleId='+pn,
		init: function() {
			var iframe = this.iframe.contentWindow;
			var ul = iframe.document.getElementById('right_list');
		},
		button: [{
			name: '保存',
			callback: function() {
				var iframe = this.iframe.contentWindow;
				var btn= iframe.document.getElementById('btnn').click();
				if(btn==true){
					
				}else{
					return false;
				}
			},
			focus: true

		}, {
			name: '取消',
			callback: function() {

			}
		}]
	});
}
//添加发票
function addBill(receiptId) {
	$.dialog({
		title: '添加发票',
		width: 600,
		height: 580,
		content: 'url:/market/receipt/addBill?receiptId='+receiptId,
		init: function() {
			var iframe = this.iframe.contentWindow;
			var ul = iframe.document.getElementById('right_list');
		},
		button: [{
			name: '保存',
			callback: function() {
				var iframe = this.iframe.contentWindow;
				var btn= iframe.document.getElementById('btnn').click();
				if(btn==true){
					
				}else{
					return false;
				}
			},
			focus: true

		}, {
			name: '取消',
			callback: function() {

			}
		}]
	});
}
//开票
function kaiBill(billId) {
	$.dialog({
		title: '开发票',
		width: 600,
		height: 580,
		content: 'url:/market/receipt/selBillById?billId='+billId,
		init: function() {
			var iframe = this.iframe.contentWindow;
			var ul = iframe.document.getElementById('right_list');
		},
		button: [{
			name: '保存',
			callback: function() {
				var iframe = this.iframe.contentWindow;
				var btn= iframe.document.getElementById('btnn').click();
				if(btn==true){
					
				}else{
					return false;
				}
			},
			focus: true

		}, {
			name: '取消',
			callback: function() {

			}
		}]
	});
}

/*配置警示框和弹出确认框*/
toastr.options = {
	"closeButton": true, //是否显示关闭按钮
	"debug": false, //是否使用debug模式
	"positionClass": "toast-top-center", //弹出窗的位置
	"showDuration": "300", //显示的动画时间
	"hideDuration": "100", //消失的动画时间
	"timeOut": "1000", //展现时间
	"showEasing": "swing", //显示时的动画缓冲方式
	"hideEasing": "linear", //消失时的动画缓冲方式
	"showMethod": "fadeIn", //显示时的动画方式
	"hideMethod": "fadeOut", //消失时的动画方式
	"progressBar": true
};

function alertNew(msg, issuccess) {
	if(issuccess) {
		toastr.success(msg);
	} else {
		toastr.warning(msg);
	}
}

function alertinfo(msg, issuccess, action) {
	alertNew(msg, issuccess);
	if(action != null) {
		setTimeout(action, 1000);
	}
}

function confirminfo(title, msg, action) {
	return art.dialog({
		id: 'Confirm',
		icon: 'question',
		fixed: true,
		lock: true,
		opacity: 0.5,
		content: title,
		ok: function(here) {
			action();
		},
		cancel: function(here) {
			art.dialog.close();
		}
	});
}
/*警示框效果*/
function alert_t() {
	alertinfo("你点击了搜索按钮！", false);
}

/*点击上边表格显示下面表格*/
$('#top_table tbody tr').click(function() {
	//var index=$(this).index();
	var inner = $(this).find('td:eq(1)').html();
	$(this).addClass('tr_active').siblings().removeClass('tr_active');
	$(this).parents('.ibox-content').siblings('.table_bot').css('display', 'block');
	$(this).parents('.ibox-content').siblings('.table_bot').find('tr').find('td:eq(1)').html(inner);
})
